﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iRSDKSharp;

namespace iRacingSdkWrapper
{
    public class SessionInfoValue
    {
        internal SessionInfoValue(SessionInfo sessionInfo, string yamlPath)
        {
            _SessionInfo = sessionInfo;
            _YamlPath = yamlPath;
        }

        private readonly SessionInfo _SessionInfo;
        public SessionInfo SessionInfo {get { return _SessionInfo; }}

        private readonly string _YamlPath;
        public string YamlPath {get { return _YamlPath; }}

        private string _Value;
        public string Value
        {
            get { return _Value ?? (_Value = this.GetValue()); }
        }

        private string GetValue()
        {
            return YamlParser.Parse(this.SessionInfo.Yaml, this.YamlPath);
        }
    }
}
